const farUrl = 'http://localhost:8080'
const imgUrl = 'http://localhost:8080/pic/'

const productUrl = farUrl + '/shopping/product'
const userUrl = farUrl + '/shopping/user'
const carUrl = farUrl + '/shopping/cart'
const addressUrl = farUrl + '/shopping/shipping'
const orderUrl = farUrl + '/shopping/order'
const payUrl = farUrl + '/shopping/pay'

//判断是否由用户登录
function LoginOr() {
  if (localStorage.username) {
    $('.userName').text(localStorage.username)
    $('.unLogin').addClass('none')
    $('.Logined,.myAccount').removeClass('none')
  }
  // $.ajax({
  //   type: 'POST',
  //   url: userUrl,
  //   data: { 'type': 'is_login' },
  //   dataType: 'json',
  //   xhrFields: { withCredentials: true },
  //   success: function (res) {
  //     console.log(res)
  //     if (res.status === 0) {
  //       // console.log(res)
  //       // console.log('用户,' + res.data[0].username + ',已登录')
  //       $('.userName').text(res.data[0].username)
  //       //缓存存下用户名
  //       // localStorage.username = res.data[0].username

  //       $('.unLogin').addClass('none')
  //       $('.Logined,.myAccount').removeClass('none')
  //       return res.data.username
  //     } else if (res.status === 100) {
  //       return null
  //     }
  //   },
  //   error: function () {
  //     console.log('错误')
  //   }
  // })
}


//先清空地址列表在渲染